﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TimeEntry.cs" company="Mar3ek">
//   http://mar3ek.wordpress.com
// </copyright>
// <summary>
//   The time entry.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace ColorhatNet
{
    using System;
     
    /// <summary>
    /// The time entry.
    /// </summary>
    public class TimeEntry
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="TimeEntry"/> class. 
        /// </summary>
        /// <param name="date">
        /// Date for the time entry.
        /// </param>
        /// <param name="customer">
        /// Customer for the date entry.
        /// </param>
        /// <param name="project">
        /// Project for the date entry.
        /// </param>
        /// <param name="service">
        /// Service for the time entry.
        /// </param>
        /// <param name="user">
        /// The user.
        /// </param>
        /// <param name="annotation">
        /// Annotation of the time entry.
        /// </param>
        /// <param name="startTime">
        /// Start time of the time entry.
        /// </param>
        /// <param name="endTime">
        /// End time of the time entry.
        /// </param>
        public TimeEntry(DateTime date, string customer, string project, string service, string user, string annotation, DateTime startTime, DateTime endTime)
        {
            this.EndTime = endTime;
            this.StartTime = startTime;
            this.Annotation = annotation;
            this.Service = service;
            this.Project = project;
            this.Customer = customer;
            this.Date = date;
            this.User = user;
        }

        /// <summary>
        /// Gets the date.
        /// </summary>
        public DateTime Date { get; private set; }

        /// <summary>
        /// Gets the customer.
        /// </summary>
        public string Customer { get; private set; }

        /// <summary>
        /// Gets the project.
        /// </summary>
        public string Project { get; private set; }

        /// <summary>
        /// Gets the service.
        /// </summary>
        public string Service { get; private set; }

        /// <summary>
        /// Gets the annotation.
        /// </summary>
        public string Annotation { get; private set; }

        /// <summary>
        /// Gets the start time.
        /// </summary>
        public DateTime StartTime { get; private set; }

        /// <summary>
        /// Gets the end time.
        /// </summary>
        public DateTime EndTime { get; private set; }

        /// <summary>
        /// Gets the duration of this time entry.
        /// </summary>
        public TimeSpan Duration 
        {
            get
            {
                return this.EndTime - this.StartTime;
            }
        }

        /// <summary>
        /// Gets the user.
        /// </summary>
        public string User { get; private set; }
    }
}